#ifndef CHATINGTAB_H
#define CHATINGTAB_H

#include <QWidget>
#include "logic/dataDefination.h"

namespace Ui {
    class Conversation;
}

class ChatingTab : public QWidget
{
    Q_OBJECT
public:
    explicit ChatingTab(const QString &ip);
    ~ChatingTab();
    void updateMessage(const QList<recordInfo> &messageList);

    inline const QString & getIp() const { return mIp; }

signals:
    void sendMessage(const QString &ip, const QString &message);

private slots:
    void onSendMessage();

private:
    void convertMessageToHtml(const QList<recordInfo> &messageList, QString &outputHtml);
    void moveToLastLine();

private:
    Ui::Conversation *mUi;
    QString mIp;

};

#endif // CHATINGTAB_H
